#pragma once

#include <YSimpleSystem/YProactorToken.h>
#include <WinSock2.h>
#include <YSimpleNetwork/YEndPoint.h>

namespace ysimple_network
{
	struct ISendToCallback;
	struct IUDPSession;
	struct YPacket;

	class YProactorTokenOnSendTo :
		public ysimple_system::YProactorToken
	{
		YEndPoint			m_toEndPoint;
		ISendToCallback*	m_pCallback;
		WSABUF				m_wsabuf;
		PACKETBLOCK_SPTR		m_packet;
		IUDPSession*		m_pSession;
	public:
		YProactorTokenOnSendTo(void);
		virtual ~YProactorTokenOnSendTo(void);

		void				beginInit(PACKET_SPTR packet, ISendToCallback& callback, IUDPSession& fromSession, const YEndPoint& toEndPoint);
		void				endInit(bool success);
		bool				onCompleted(bool completionStatus, LONG_PTR		completionKey, DWORD			dwBytesTransfered ) override;
		WSABUF*			getWSABuf();
		DWORD			getWSABufCount();
		
	};

}

